/**
 * Created by Administrator on 2014/12/25.
 */
package test {
import feathers.controls.Button;
import feathers.controls.Label;
import feathers.controls.List;
import feathers.data.ListCollection;

import flash.geom.Point;

import flash.text.TextFormat;

import starling.display.Image;

import starling.display.Sprite;
import starling.utils.Color;

import utils.Kit;

public class TestFeathers extends Sprite {

    /**
     *
     */
    public function TestFeathers() {
    }

    /**
     *
     */
    public function testFeathers():List {
        return new List();
    }


    /**
     *
     */
    public static function testList():List {
        var list:List = new List();
        list.width = 720;
        list.height = 720;

        var location:Point = Kit.midPoint(list);
        list.x = location.x;
        list.y = location.y;

        var data:Array = [
            {text: "Milk", thumbnail: GameSystem.assetManager.getTexture("bomb")},
            {text: "Eggs", thumbnail: GameSystem.assetManager.getTexture("bomb")},
            {text: "Bread", thumbnail: GameSystem.assetManager.getTexture("bomb")},
            {text: "Chicken", thumbnail: GameSystem.assetManager.getTexture("bomb")},
        ];

        //ListCollection支持 Vector, Array, 和 XMLList
        list.dataProvider = new ListCollection(data);

        list.itemRendererProperties.labelField = "text";
        list.itemRendererProperties.color = Color.RED;
        list.itemRendererProperties.iconTextureField = "thumbnail";

//        list.itemRendererProperties.horizontalAlign = Button.HORIZONTAL_ALIGN_CENTER;
//        list.itemRendererProperties.verticalAlign = Button.VERTICAL_ALIGN_MIDDLE;
//        list.itemRendererProperties.iconPosition = Button.ICON_POSITION_TOP;
//        list.itemRendererProperties.gap = 10;
        return list;
    }


    /**
     * 测试UI  feathers
     */
    private function testButton():void {
//        var list:List = new List();
//        list.width = 480;
//        list.height = 320;
//        addChild(list);

        var button:Button = new Button();
        button.label = "Click Me";
        button.defaultSkin = new Image(GameSystem.assetManager.getTexture("bomb"));
        this.addChild(button);


        var label:Label = new Label();
        label.text = "Hello Worlddddddd";
        label.textRendererProperties.textFormat = new TextFormat("Arial", 24, 0x323232);
        label.textRendererProperties.embedFonts = true;
        label.textRendererProperties.isHTML = true;
        this.addChild(label);

    }


}


}
